<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  
</body>
<script>
  
  document.onmousemove = function(eve){
    var e = eve || window.event;
    // 通过假设获取元素，判断页面是否存在初始元素
    var txt = document.querySelector(".txt");
    // 不存在
    if(!txt){
      // 创建
      txt = document.createElement("span");
      // 插入
      document.body.appendChild(txt);
      // 设置class
      txt.className = "txt";
      // 设置定位
      txt.style.position = "absolute";
    }
    // 存在，只修改left和top
    txt.style.left = e.pageX + 10 + "px";
    txt.style.top = e.pageY + 10 + "px";
    // 重置内容
    txt.innerText = e.pageX + ", " + e.pageY;
  }

</script>
</html>